import styles from "@/app/components/dialog/dialog-head.module.scss";
import {userChatStore} from "@/app/store/chat-store";
import {useNavigate} from "react-router-dom";

export default function DialogHead() {
    const navigate = useNavigate();
    const chatStore = userChatStore();

    return (
        <div className={styles["dialog-head"]}>
            <div className={styles["dialog-search-box"]}><input type="text" placeholder="搜索"/></div>
            <div className={styles["dialog-search-add"]} onClick={() => {
                const session = chatStore.openSession();
                chatStore.selectSession(0);
                navigate(`/chat/${session.id}`, {state: {title: session.dialog.title}})
            }}></div>
        </div>
    )
}
